import {INCREMENT, SUBTRACTION} from '../action_types.js'

let initState = 0
export default function (preState=initState, action) {
  let {type, data} = action
  switch (type) {
    case INCREMENT:
      return preState + data
    case SUBTRACTION:
      return preState - data
    default:
      return preState
  }
}
